<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AddColumnToActivity extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('activity');
        $table->addColumn('threshold', 'boolean', ['limit' => 1, 'after' => 'activity_type', 'default' => 0, 'comment' => '是否设置了报名门槛 1是 0否','signed'=>false])
            ->addColumn('shop_type', 'string', ['limit' => 200, 'after' => 'threshold', 'default' => '[]', 'comment' => '店铺类型 0普通店 1专营店 2旗舰店 3专卖店 4商场店','signed'=>false])
            ->addColumn('freshman_shop', 'boolean', ['limit' => 1, 'after' => 'shop_type', 'default' => 0, 'comment' => '新手店铺是否选了 1已选 0未选','signed'=>false])
            ->addColumn('is_new', 'boolean', ['limit' => 1, 'after' => 'shop_type', 'default' => 1, 'comment' => '新手店铺是否可报名 1可报名 0不可报名','signed'=>false])
            ->addColumn('shop_score', 'boolean', ['limit' => 1, 'after' => 'is_new', 'comment' => '商家体验分 0不限 1大等于4  2大等于4.3 3大等于4.5 4大等于4.8','signed'=>false])
            ->save();;
    }
}
